WPS Office.apk(点击下载) / htq.java


package defpackage;

import android.app.Activity;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.StatFs;
import defpackage.lwd;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;

/* renamed from: htq  reason: default package */
public final class htq {
    Runnable eNP;
    private String[] gKS;
    String gKT;
    String gKV;
    String gKW;
    public float gKY;
    public float gKZ;
    boolean gLb = true;
    Runnable gLe;
    public czq gLh;
    public boolean gLj = false;
    lwd.c gSY;
    String iNB;
    public File[] iNC;
    private a iND;
    public Activity mActivity;
    Handler mHandler = new Handler(Looper.getMainLooper());

    /* renamed from: htq$a */
    class a extends lwd.b {
        private a() {
        }

        /* synthetic */ a(htq htq, byte b) {
            this();
        }

        @Override // defpackage.lwd.b, defpackage.lwd.a
        public final void uL(int i) {
            htq htq = htq.this;
            long j = (long) i;
            StatFs statFs = new StatFs(Environment.getDataDirectory().getAbsolutePath());
            if (!((Build.VERSION.SDK_INT >= 18 ? statFs.getAvailableBytes() : ((long) statFs.getBlockSize()) * ((long) statFs.getAvailableBlocks())) > j)) {
                htq.this.gLb = false;
                htq.a(htq.this);
            }
        }
    }

    public htq(Activity activity, Runnable runnable, Runnable runnable2) {
        this.mActivity = activity;
        this.eNP = runnable;
        this.gLe = runnable2;
        this.gKW = "libwpsstv1.zip";
        this.gKY = 1.0f;
        htr.ckA().ckC();
        this.gKZ = htr.ckA().ckB();
        this.gKV = lwt.IO(this.mActivity.getApplicationInfo().dataDir);
        this.gKS = hto.iNz;
        this.iNC = new File[this.gKS.length];
        for (int i = 0; i < this.gKS.length; i++) {
            this.iNC[i] = lwt.p(this.gKS[i], this.mActivity.getApplicationInfo().dataDir, true);
        }
        this.gKT = "http://cloudservice15.kingsoft-office-service.com/plugins" + File.separator + this.gKW;
        this.iND = new a(this, (byte) 0);
        this.gSY = new lwd.c(this.iND);
    }

    static /* synthetic */ void a(htq htq) {
        htq.gSY.cPS = true;
    }

    static /* synthetic */ void a(htq htq, File file) throws Exception {
        ZipFile zipFile = new ZipFile(file);
        ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(file));
        while (true) {
            ZipEntry nextEntry = zipInputStream.getNextEntry();
            if (nextEntry != null) {
                File file2 = new File(htq.gKV + File.separator + nextEntry.getName());
                if (!file2.getParentFile().exists()) {
                    file2.getParentFile().mkdirs();
                }
                byte[] bArr = new byte[1024];
                FileOutputStream fileOutputStream = new FileOutputStream(file2);
                InputStream inputStream = zipFile.getInputStream(nextEntry);
                while (true) {
                    int read = inputStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    fileOutputStream.write(bArr, 0, read);
                }
                fileOutputStream.close();
                inputStream.close();
            } else {
                zipInputStream.close();
                return;
            }
        }
    }

    public void cky() {
        if (this.gLh != null && this.gLh.isShowing()) {
            this.gLh.dismiss();
        }
    }

    public void ckz() {
        for (int i = 0; i < this.iNC.length; i++) {
            if (this.iNC[i] != null && this.iNC[i].exists()) {
                this.iNC[i].delete();
            }
        }
    }
}